package com.zhijian.warehouse.manage.enums;

import java.util.Objects;

/**
 * 编码枚举
 *
 * @Author 王小宇
 * @Version 1.0.1
 */
public class CodingEnum {

    /**
     * 业务编码前缀
     */
    public enum PREFIX {

        RK("RKD", "入库", 3),
        CK("CKD", "出库", 3),
        PD("PDD", "盘点", 3),
        DB("DBD", "调拨", 3),
        DBCK("DBCK", "调拨出库", 3),
        DBRK("DBRK", "调拨入库", 3),
        LY("LY", "扫码领用", 3),
        GH("GH", "扫码归还", 3),

        ;

        public String value;
        public String msg;
        /**
         * 最终位数
         */
        public int digit;

        PREFIX(String value, String msg, int digit) {
            this.value = value;
            this.msg = msg;
            this.digit = digit;
        }

        public static PREFIX getByValue(String value) {
            PREFIX[] flags = PREFIX.values();
            for (PREFIX flag : flags) {
                if (Objects.equals(flag.value, value))
                    return flag;
            }
            return null;
        }
    }
}
